/**
 * @apiDefine order 订单
 * @apiHeader {String} token 用户登录获取的token
 */


/**
 * @api {POST} /order/checkout 收款、结账
 * @apiSampleRequest /order/checkout
 * @apiGroup order
 * @apiUse order
 * @apiParam {String} bill_num 购物车单号
 * @apiSuccess {Object} /data 数据
 * @apiSuccessExample {json} 成功响应：
 * HTTP/1.1 200 OK
 * {
 *     "errcode": 0
 * }
 */


/**
 * @api {POST} /order/create 创建订单（购物结算）
 * @apiSampleRequest /order/create
 * @apiGroup order
 * @apiUse order
 * @apiParam {String} bill_num 购物车单号
 * @apiParam {Object[]} pay_methods 支付方式
 * @apiParam {Number} pay_methods.typ 支付方式类型 1现金，2仓储卡，3余额，10线下扫码，100微信/支付宝
 * @apiParam {String} pay_methods.amount 支付金额
 * @apiParam {String} member_id 会员ID，支付类型为仓储卡时，需要传入会员ID
 * @apiParam {String} [pay_code=None] 支付码，如果支付方式包括“微信”或“支付宝”，则需要提供此参数
 * @apiParam {String} [total_amount=None] 用户提交的支付金额
 * @apiSuccess {Object} /data 数据
 * @apiSuccessExample {json} 成功响应：
 * HTTP/1.1 200 OK
 * {
 *     "errcode": 0,
 *     "data": {
 *         "total_price": "36.00", // 实收金额
 *         "cart_total_price": "29.70", // 购物车总金额
 *         "order_sn": "211023122817946811PL45E"
 *     },
 *     "detail": {
 *         "order": {
 *             "id": 204,
 *             "shop_id": 70,
 *             "cashier_id": 7,
 *             "order_sn": "211023122817946811PL45E",
 *             "pay_method": "现金",
 *             "member_id": 0,
 *             "account": "",
 *             "goods_num": 1231,
 *             "return_num": 0,
 *             "return_order_sn": "",
 *             "total_price": "36.00",
 *             "remark": "",
 *             "assoc_order_id": 0,
 *             "status": 1,
 *             "created": 1634963297,
 *             "deleted": 0
 *         },
 *         "order_detail": [
 *             {
 *                 "id": 223,
 *                 "goods_id": 1494,
 *                 "goods_name": "蒙牛高钙奶粉",
 *                 "barcode": "6940187260641",
 *                 "amount": 1230,
 *                 "selling_price": "25.00",
 *                 "is_input_price": 0,
 *                 "is_discount": 0,
 *                 "subtotal": "25.00",
 *                 "return_num": 0,
 *                 "status": 0
 *             },
 *         ]
 *     },
 *     "shop": {
 *         "shop_name": "新天地超市",
 *         "shop_phone": "13444444444",
 *         "shop_address": "太原街18号"
 *     },
 *     "order_sn": "xxxx" 订单号
 * }
 */


/**
 * @api {POST} /v2/order/create 创建订单V2（购物结算）
 * @apiSampleRequest /v2/order/create
 * @apiDescription <h3>异步后台调用第三方支付</h3>
 * @apiGroup order
 * @apiUse order
 * @apiParam {String} bill_num 购物车单号
 * @apiParam {Object[]} pay_methods 支付方式
 * @apiParam {Number} pay_methods.typ 支付方式类型 1现金，2仓储卡，3余额，10线下扫码，100微信/支付宝
 * @apiParam {String} pay_methods.amount 支付金额
 * @apiParam {String} member_id 会员ID，支付类型为仓储卡时，需要传入会员ID
 * @apiParam {String} [pay_code=None] 支付码，如果支付方式包括“微信”或“支付宝”，则需要提供此参数
 * @apiSuccess {Object} /data 数据
 * @apiSuccessExample {json} 成功响应：
 * HTTP/1.1 200 OK
 * {
 *     "errcode": 0,
 *     "data": {
 *         "total_price": "36.00",
 *         "order_sn": "211023122817946811PL45E"
 *     },
 *     "detail": {
 *         "order": {
 *             "id": 204,
 *             "shop_id": 70,
 *             "cashier_id": 7,
 *             "order_sn": "211023122817946811PL45E",
 *             "pay_method": "现金",
 *             "member_id": 0,
 *             "account": "",
 *             "goods_num": 1231,
 *             "return_num": 0,
 *             "return_order_sn": "",
 *             "total_price": "36.00",
 *             "remark": "",
 *             "assoc_order_id": 0,
 *             "status": 1,
 *             "created": 1634963297,
 *             "deleted": 0
 *         },
 *         "order_detail": [
 *             {
 *                 "id": 223,
 *                 "goods_id": 1494,
 *                 "goods_name": "蒙牛高钙奶粉",
 *                 "barcode": "6940187260641",
 *                 "amount": 1230,
 *                 "selling_price": "25.00",
 *                 "is_input_price": 0,
 *                 "is_discount": 0,
 *                 "subtotal": "25.00",
 *                 "return_num": 0,
 *                 "status": 0
 *             },
 *         ]
 *     },
 *     "shop": {
 *         "shop_name": "新天地超市",
 *         "shop_phone": "13444444444",
 *         "shop_address": "太原街18号"
 *     },
 *     "order_sn": "xxxx" 订单号
 * }
 * @apiErrorExample {json} Error-Response:
 * HTTP/1.1 200 OK
 * {
 *     "errcode": 10000,
 *     "action_code": 1 // 创建订单失败，需要重新提交创建订单。
 *     "message": "更新商品库存失败"
 * }
 */



/**
 * @api {POST} /order/anti_settlement 反结账
 * @apiSampleRequest /order/anti_settlement
 * @apiGroup order
 * @apiUse order
 * @apiParam {Number} id 订单ID
 * @apiParam {String} remark 备注
 * @apiSuccess {Object} /data 数据
 * @apiSuccessExample {json} 成功响应：
 * HTTP/1.1 200 OK
 * {
 *     "errcode": 0,
 *     "data": {
 *         "total_price": "19.80", // 支付金额
 *         "order_sn": "211014185847224736ZT4BO" // 订单号
 *     }
 * }
 */



/**
 * @api {POST} /order/return_order_goods 退货（有订单号）
 * @apiSampleRequest /order/return_order_goods
 * @apiDescription <h3>提交参数示例：</h3>
 * <p>{"id":"142","order_detail_list":[{"id":149,"num":1}]}</p>
 * @apiGroup order
 * @apiUse order
 * @apiParam {Number} id 订单ID
 * @apiParam {Object[]} order_detail_list 退货明细
 * @apiParam {Number} order_detail_list.id 订单明细ID(非商品ID)
 * @apiParam {Number} order_detail_list.num 退货数量
 * @apiSuccess {Object} /data 数据
 * @apiSuccessExample {json} 成功响应：
 * HTTP/1.1 200 OK
 * {
 *     "errcode": 0,
 *     "stats_data": { // 退款统计信息
 *         "row_num": 1, // 退款商品款数
 *         "total_num": 1, // 退款商品件数
 *         "return_yuan": "15.90", // 退款总金额
 *         "pay_yuan": "15.90" // 核对金额
 *     },
 *     "refund_result": [
 *         {
 *             "refund_typ_name": "余额", // 退款方式
 *             "refund_typ": 3, // 退款方式ID
 *             "return_amount": "15.90", // 退款总金额
 *             "pay_data": [ // 相关支付记录
 *                 {
 *                     "id": 108,
 *                     "order_id": 142,
 *                     "pay_method_typ": 3,
 *                     "pay_method": "余额",
 *                     "pay_typ_id": 0,
 *                     "pay_amount": "19.40"
 *                 }
 *             ]
 *         }
 *     ]
 * }
 */



/**
 * @api {POST} /order/query_trade_state 查询第三方支付状态并更新收银订单
 * @apiSampleRequest /order/query_trade_state
 * @apiGroup order
 * @apiUse order
 * @apiParam {String} order_sn 订单编号
 * @apiSuccess {Object} /data 数据
 * @apiSuccessExample {json} 成功响应：
 * HTTP/1.1 200 OK
 * {
 *     "errcode": 0,
 *     "is_paid": 1, // 是否支付
 *     "result_code": "", // 第三方支付查询结果，三种结果SUCCESS、FAIL、未知（空字符串），如果返回结果为空，需要继续轮询
 *     "msg": ""
 * }
 */
